package FlowGram.Application.CommandHost.FinchActionListeners;

import java.awt.event.ActionEvent;
import java.io.File;

import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

import FlowGram.Application.Parser.Actions.Chirp;
import FlowGram.Application.Parser.Actions.Control.Include;
import FlowGram.Application.User.CreateUser;

public class IncludeListener extends FinchActionListener {
	JFrame frame;
	
	Include	IncludeAct;
	
	public IncludeListener(JFrame frame){
		this.frame = frame;
	}
	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		IncludeAct = new Include();
		
//		String s = (String)JOptionPane.showInputDialog(
//				frame,
//				"Comment:\n",
//				"Create Comment",
//				JOptionPane.QUESTION_MESSAGE);
		File file;
		String s = "";
		JFileChooser fChooser = new JFileChooser();
		int returnVal = fChooser.showOpenDialog(frame);
		if (returnVal == JFileChooser.APPROVE_OPTION) {
			s = fChooser.getSelectedFile().getAbsolutePath();
       }else {
//           directory.append("Open command cancelled by user.");
       }
		
		IncludeAct.setFilepath(s);
		
		addCodeTop(IncludeAct);
		
		
	}
}
